package day04;
import java.util.Scanner;
public class Exercise02 {
    public static void main(String[] args) {
        //1.CommandBySwitch命令解析程序：
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入选项:1.A 2.B 3.C 4.D" );
        int a1 = sc.nextInt();
        switch (a1){
            case 1:
                System.out.println("A");
                break;
            case 2:
                System.out.println("B");
                break;
            case 3:
                System.out.println("C");
                break;
            case 4:
                System.out.println("D");
                break;
            default:
                System.out.println("没有此选项！");
        }


        //2. Guessing猜数字之while版
        int a2 = (int)(Math.random()*1000+1);
        System.out.println(a2);
        int b2 = sc.nextInt();
        while (b2!=a2){
            if (b2<a2){
                System.out.println("猜小了！");
            }else{
                System.out.println("猜大了！");
            }
            b2 = sc.nextInt();
        }
        System.out.println("恭喜你猜对了！");


        //3. Guessing猜数字之do...while版
        int a3 = (int)(Math.random()*1000+1);
        System.out.println(a3);
        int b3;
        do {
            b3 = sc.nextInt();
            if (b3<a3){
                System.out.println("猜小了！");
            }else if (b3>a3){
                System.out.println("猜大了！");
            }else {
                System.out.println("恭喜你猜对了！");
            }
        }while (b3!=a3);


        //4.for循环
        for (int a4=0; a4<5;a4++){
            System.out.println("语言基础第四天");
        }

        for (int i=1;i<=9;i++){
            System.out.println(i+"*9="+i*9);
        }

        for (int j=1;j<=9;j+=2){
            System.out.println(j+"*9="+j*9);
        }

        for (int m=9;m>=1;m--){
            System.out.println(m+"*9="+m*9);
        }
    }
}
